<template>
  <div class="epub-cover">
    <img :src="href" v-if="href" />
  </div>
</template>

<script>

export default {
  props: {
    ebook: {
      type: Object,
      default: () => null
    },
    route: {
      type: Object,
      default: () => null
    }
  },
  computed: {
    href() {
      return this.ebook ? this.ebook.info.cover : undefined
    }
  },
  mounted() {
    // 开始倒计时 阅读正文
    var linear = this.ebook.data.linear.find((item)=> item.startsWith('id:'))
    setTimeout(()=> {
      this.$emit('change', {
        linear,
        context: {}
      })
    }, 1000)
  }
}
</script>

<style>
.epub-cover {
  width: 100%;
  height: 100%;
}

.epub-cover img {
  object-fit: contain;
  width: 100%;
  height: 100%;
}
</style>
